<template>
  <div>
    <div>
      <div class="title">
        <h4>芙蓉楼送辛渐</h4>
        <span class="btn" @click="btn">
          {{ isShow ? "收起" : "展开" }}
        </span>
      </div>
      <div class="container" v-show="isShow">
        <slot></slot>
        <!-- <p>寒雨连江夜入吴,</p>
        <p>平明送客楚山孤。</p>
        <p>洛阳亲友如相问，</p>
        <p>一片冰心在玉壶。</p> -->
      </div>
      <div>
        <slot :row="defaultObj">{{ defaultObj.default1 }}</slot>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      isShow: false,
      defaultObj: {
        default1: "跑车",
        default2: "汽车",
      },
    };
  },
  methods: {
    btn() {
      this.isShow = !this.isShow;
    },
  },
};
</script>

<style scoped>
h3 {
  text-align: center;
}
.title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border: 1px solid #ccc;
  padding: 0 1em;
}
.title h4 {
  line-height: 2;
  margin: 0;
}
.container {
  border: 1px solid #ccc;
  padding: 0 1em;
}
.btn {
  /* 鼠标改成手的形状 */
  cursor: pointer;
}
</style>